home *** CD-ROM | disk | FTP | other *** search
- C Program EX_0401.FOR
- C Listing 6F - see documentation in TUTOR.SSS
-
- $include:'SSSF1.H'
-
- subroutine prime
- $include:'SSSF2.H'
- integer ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS
- real*8 c, mean, min, mode, max, limit
- common ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS,
- + c, mean, min, mode, max, limit
- real*8 endt
- data endt /40.0/
-
- ARRIVL = 1
- TRYBUY = 2
- REPLNS = 3
- CUSTMR = 0
- GOODS = 1
- mean = 2.0
- c = 15.0
- min = 5.0
- mode = 7.0
- max = 9.0
- limit = 4.0
-
- call INIQUE(0, 0, 2)
- call inista(1,'Outof stock ',0, 0, 0, 0)
- call inista(2,'Avestock ',1, 0, 0, 0)
- call SIMEND(endt)
- call CREATE(EX(mean), CUSTMR)
- call TALLY(2, c)
- return
- end
-
- subroutine buying
- $include:'SSSF2.H'
- integer ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS
- real*8 c, mean, min, mode, max, limit
- common ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS,
- + c, mean, min, mode, max, limit
-
- if (c.eq.limit)
- + call CREATE(TR(min, mode, max), GOODS)
- if (c.gt.0) then
- c = c - 1
- else
- call TALLY(1, 1)
- endif
- call TALLY(2, c)
- call DISPOS
- return
- end
-
- subroutine order
- $include:'SSSF2.H'
- integer ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS
- real*8 c, mean, min, mode, max, limit
- common ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS,
- + c, mean, min, mode, max, limit
-
- c = c + 12
- call TALLY(2, c)
- call DISPOS
- return
- end
-
- Program EX_0401
- $include:'SSSF2.H'
- integer ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS
- real*8 c, mean, min, mode, max, limit
- common ARRIVL, TRYBUY, REPLNS, CUSTMR, GOODS,
- + c, mean, min, mode, max, limit
- integer ecode
-
- call prime
-
- 99 ecode = NEXTEV()
- if (ecode.gt.0) then
- goto (101, 102, 103) ecode
-
- C ARRIVL
- 101 continue
- if (IDE().eq.CUSTMR) then
- call CREATE(EX(2.0), CUSTMR)
- call SCHED(0.0, TRYBUY, IDE())
- else
- call SCHED(0.0, REPLNS, IDE())
- endif
- goto 99
-
- C TRYBUY
- 102 continue
- call buying
- goto 99
-
- C REPLNS
- 103 continue
- call order
- goto 99
-
- else
-
- call SUMRY(' ')
- stop 'End of simulation'
-
- endif
- end
-